﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;

namespace SchEdu.Framework.DataModel
{
    public class ResourceList : List<Resource>
    {
        public ResourceList()
        {
        }

        public Resource GetNextAvailableResource()
        {
            Resource nextAvailableResource = null;

            foreach(Resource resource in this)
            {
                if (nextAvailableResource == null)
                {
                    nextAvailableResource = resource;
                    continue;
                }

                if (resource.AvailableDate < nextAvailableResource.AvailableDate)
                {
                    nextAvailableResource = resource;
                }
            }

            return nextAvailableResource;
        }
    }
}
